import Vue from "vue";
import "./plugins/axios";
import App from "./App.vue";
// import router from "./router";
import store from "./store";
import vuetify from "./plugins/vuetify";
import i18n from "./i18n/index.js";

import YYS from "./api/YYSEventHub.js";

Vue.config.productionTip = false;

Vue.prototype.$YYS = YYS;

var vue = new Vue({
  // router,
  store,
  vuetify,
  i18n,
  render: (h) => h(App),
});

vue.$mount("#app");
// handle uncaught exception
process.on("uncaughtException", (err, origin) => {
  console.log("捕获 uncaughtException 异常: ", err);
  console.log("捕获 origin 异常: ", origin);

  if (!err) {
    return;
  }

  // 发送错误消息
  // vue.$message.error({
  //   message: "Uncaught Exception: " + err,
  //   duration: 5000,
  // });

  // 记录错误
  Vue.$YYS.$emit("closeConnection");
});

export default vue;
